package com.foreknow.demo2;

import java.util.Scanner;

/**
 * 用户如何从控制台输入数据
 * Scanner
 */
public class ScannerDemo {
    public static void main(String[] args) {
        //1.创建一个Scanner
        //System.in 表示系统输入
//        Scanner input = new Scanner(System.in);
//        System.out.println("请输入:");
//        //2.从控制台来接受用户输入
////        int num = input.nextInt();
////        System.out.println(num);
//        int i = input.nextInt();
//        char c = (i % 2 == 0)?'是':'否';
//        System.out.println(c);

        Scanner input = new Scanner(System.in);
        System.out.println("请输入用户名:");
        String name = input.next();
        System.out.println("请输入性别:");
        String sex = input.next();
        System.out.println("请输入年龄:");
        int age = input.nextInt();
        System.out.println("请输入薪资:");
        double salary = input.nextDouble();
        System.out.println("用户名: "+ name +"性别: "+ sex +"年龄: " +age+"薪资: " +salary);
    }
}
